package com.liang.inet;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAdressDemo {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress inet = InetAddress.getByName("192.168.1.1");

        String name = inet.getHostName();
        String ip = inet.getHostAddress();
        System.out.println("主机名为："+name);
        System.out.println("ip为："+ip);


    }
}
